#!/bin/sh
echo "  ezgmodds - Install"
echo "========================================================="
echo "  This script will install ezgmodds to /usr/local/bin."
echo "  Afterwards it can be called with the command \"ezgmodds\""
echo ""
printf "%s" "    Proceed?  y/n: "; read LINE
if [ "$LINE" = "y" ]; then
  sudo mkdir -p /usr/local/bin
  sudo cp -f ./ezgmodds.sh /usr/local/bin/ezgmodds
  sudo chmod 0711 /usr/local/bin/ezgmodds
  sudo chmod a+rx /usr/local/bin/ezgmodds
  sudo chown root:root /usr/local/bin/ezgmodds
fi
echo ""
echo "  ezgmodds requires sudo permission.  This script can"
echo "  add ezgmodds to your sudoers file so a password is"
echo "  not required each time."
echo ""
printf "%s" "  Add ezgmodds to the sudoers file? y/n: "; read LINE
if [ "$LINE" = "y" ]; then
  sudo echo "#!/bin/bash
  echo \"\`sudo cat /etc/sudoers | grep -Fv ezgmodds; echo '%sudo ALL= NOPASSWD: /usr/local/bin/ezgmodds'\`\" >/etc/sudoers" >/tmp/ezgmodds.sudoersmod
  sudo chmod a+rx /tmp/ezgmodds.sudoersmod
  sudo /tmp/ezgmodds.sudoersmod
  sudo rm -rf /tmp/ezgmodds.sudoersmod
fi
echo ""
echo "  ezgmodds - Install complete"
echo "  Run uninstall.sh to uninstall ezgmodds"
echo ""
exit 0
